package Demo24;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-12-20
 * Time: 19:28
 */
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Media[] ms = new Media[n];
        for (int i = 0; i < n; i++) {
            String type = sc.next();
            if (type.equals("book")) {
                ms[i] = new Book(sc.next(), sc.nextDouble());
            } else {
                ms[i] = new DVD(sc.next());
            }
        }
        double rent = MediaShop.calculateRent(ms, sc.nextInt());
        System.out.printf("%.2f", rent);
    }
}
class Media{
    public String name;

    public Media(String name) {
        this.name = name;
    }

    public double getDailyRent() {return 1;}
}
class Book extends Media{
    public double price;
    public Book(String name, double price) {
        super(name);
        this.price = price;
    }

    @Override
    public double getDailyRent() {
        return price*0.01;
    }

}
class DVD extends Media{
    public DVD(String name) {
        super(name);
    }

    @Override
    public double getDailyRent() {
        return 1;
    }
}
class MediaShop{
    static double calculateRent(Media[] medias, int days){
        double sum = 0;
        for (int i = 0; i < medias.length ; i++) {
            sum += medias[i].getDailyRent();
        }
        return sum*days;
    }
}
/* 请在这里填写答案 */